home *** CD-ROM | disk | FTP | other *** search
- Path: anvil.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.c
- Subject: Re: What does the -O option do???!!!
- Date: 12 Feb 1996 10:43:35 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4fo1onINNlma@anvil.ugrad.cs.ubc.ca>
- References: <4ehger$cj9@mark.ucdavis.edu> <9602102332.AA09466@dxmint.cern.ch> <4flhrhINNtj@keats.ugrad.cs.ubc.ca> <9602120013.AA06318@ues5.cern.ch>
- NNTP-Posting-Host: anvil.ugrad.cs.ubc.ca
-
- In article <9602120013.AA06318@ues5.cern.ch>, Dan Pop <Dan.Pop@cern.ch> wrote:
- >c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku) writes:
- >
- >>In article <9602102332.AA09466@dxmint.cern.ch>,
- >>Dan Pop <danpop@mail.cern.ch> wrote:
- >>>c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku) writes:
- >>>
- >>>>... as long as it is not hard-coded to treat identifiers like "free" specially.
- >>>
- >>>A compiler is free to treat identifiers like "free" specially after the
- >>>relevant header has been included.
- >>>
- >>>>If you write your own free() with different semantics, you would not want the
- >>>>compiler messing with that.
- >>>
- >>>If you write your own free() you invoke undefined behaviour and you can't
- >>>expect the compiler to behave in a sensible way. The implementation
- >>>namespace is a big taboo in C.
- >>
- >>Are you serious? What if I'm writing a little embedded kernel that doesn't use
- >>anything resembling the standard C library, and I use free() for something
- >>quite different?
- >
- >Could you, please, actually read the standard before continuing to post
- >on this thread? You'll find there a clear distinction between freestanding
- >and hosted environments.
-
- Ah ok. So in effect there is a sort of "switch" to turn off the special
- treatment of things like memcpy(). I mean, it's nice that some things can be
- optimized by the compiler when the standard allows it to treat certain
- functions as though they were operators, so that memcpy() is translated into
- inline code. What I said was that it's desirable to turn it off. By allowing
- for the freestanding environment distinction, the standard allows this---I see
- it now. I wouldn't want to give up the optimization of memcpy() for religious
- reasons. :)
- --
-
-